<!DOCTYPE html>
<html
  layout:decorator="components/layout"
  xmlns="http://www.w3.org/1999/xhtml"
  xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
>
<head>
  <meta
    http-equiv="Content-Type"
    content="text/html; charset=utf-8"
  />
  <title>编辑管理员</title>
</head>
<body>
<div
  layout:fragment="content"
  class="container"
  id="app" v-cloak
>
  <div class="container">
    <div class="myHeader">
      <div class="myHeader-title">
        修改用户信息
      </div>
      <div class="myHeader-tool">
        <el-button
          size="mini"
          @click="deleteSysUser"
          type="danger"
          v-realm="'system-configuration:sys-user:edit'"
        >删除管理员
        </el-button>
        <el-button
          size="mini"
          @click="_forward('security-log/admin_security_auditloglist')"
        >查看操作记录
        </el-button>
        <el-button
          size="mini"
          @click="forward('security-log/admin_security_securityloglist')"
        >查看登录日志
        </el-button>
        <el-button
          size="mini"
          @click="_forward('/system-config/add/admin_privilege_admin_add')"
          v-realm="'system-configuration:sys-user:edit'"
          type="primary"
        >新增管理员
        </el-button>
      </div>
    </div>

    <div class="myTabs">
      <el-tabs v-model="activeName" type="border-card">

        <el-tab-pane label="基本" name="mode1">
          <div class="myHeader">
            <div class="myHeader-title">
              {{sysUser.loginName}}
            </div>
          </div>
          <table
            width="100%"
            border="0"
            class="el-table el-table--border"
            cellspacing="0"
            cellpadding="0"
          >
            <tbody>
            <tr>
              <td
                width="100"
              ><b>状态</b></td>
              <td>
                <input
                  v-show="sysUser.status === 1"
                  type="image"
                  src="/static/img/icon_open.gif"
                  title="点击关闭"
                  @click="updateSysUser({status: 2})"
                >
                <input
                  v-show="sysUser.status === 2"
                  type="image"
                  src="/static/img/icon_close.gif"
                  title="点击开启"
                  @click="updateSysUser({status: 1})"
                >
              </td>
            </tr>
            <tr>
              <td><b>创建日期</b></td>
              <td>{{dateFormat(sysUser.createTime)}}</td>
            </tr>
            <tr>
              <td><b>上次登录</b></td>
              <td>{{dateFormat(sysUser.lastLoginTime)}}，<br> 来自 {{sysUser.loginSource}}
              </td>
            </tr>
            <tr>
              <td><b>属于的管理员组</b></td>
              <td>
                <el-select
                  v-model="roleIdList"
                  multiple
                  size="mini"
                >
                  <el-option
                    v-for="role in roles"
                    :value="role.id"
                    :key="role.id"
                    :label="role.name"
                  >
                  </el-option>
                </el-select>
                <el-button
                  @click="updateSysUser(sysUser)"
                  type="primary"
                  size="mini"
                  v-realm="'system-configuration:sys-user:edit'"
                >更新组</el-button>
              </td>
            </tr>
            </tbody>
          </table>
        </el-tab-pane>
        <el-tab-pane label="权限" name="mode2">
          <div class="myHeader">
            <div class="myHeader-title">
              {{sysUser.loginName}} 的权限设置
            </div>
          </div>
          <table
            cellpadding="0"
            cellspacing="0"
            class="el-table el-table--border"
            border="0"
          >
            <tbody>
            <tr>
              <td>可添加权限</td>
              <td width="120px"></td>
              <td>已拥有权限</td>
            </tr>
            <tr>
              <td>
                <select
                  v-model="notIncludeSysMenuSelectList"
                  style="width: 100%"
                  multiple
                >
                  <option
                    v-for="sysMenu in form.notIncludeSysMenuList"
                    :value="sysMenu"
                  >{{sysMenu.label}}
                  </option>
                </select>
              </td>
              <td align="left">
                <el-row>
                  <el-button
                    size="mini"
                    type="primary"
                    @click="addSysMenuList"
                  >添加 >>
                  </el-button>
                </el-row>
                <el-row>
                  <el-button
                    size="mini"
                    type="danger"
                    @click="deleteSysMenuList"
                  >删除 <<
                  </el-button>
                </el-row>

              </td>
              <td>
                <input
                  type="hidden"
                  name="groupprivileges"
                >
                <select
                  v-model="includeSysMenuSelectList"
                  multiple
                  style="width: 100%"
                  name="groupprivileges_select"
                >
                  <option
                    v-for="sysMenu in form.includeSysMenuList"
                    :value="sysMenu"
                  >{{sysMenu.label}}
                  </option>
                </select>
              </td>
            </tr>
            <tr>
              <td
                colspan="4"
                align="center"
              >
                （按住Ctrl键，可用鼠标同时选择多个组）
              </td>
            </tr>
            </tbody>
          </table>
          <div align="center">
            <el-button
              type="primary"
              @click="updateUserMenu"
              v-realm="'system-configuration:sys-user:edit'"
            >保存权限</el-button>&nbsp;
            <el-button
              @click="_forward('system-config/admin_privilege_admin_list')"
            >返回</el-button>
          </div>
        </el-tab-pane>
        <el-tab-pane label="个人资料" name="mode3">

          <div class="myHeader">
            <div class="myHeader-title">
              {{sysUser.loginName}} 的个人资料设置
            </div>
          </div>
          <table
            width="100%"
            border="0"
            class="el-table el-table--border"
            cellspacing="0"
            cellpadding="0"
          >
            <tbody>
            <tr>
              <td
                width="100"

              ><b>认证邮箱</b></td>
              <td>
                <el-input
                  v-model="sysUser.regMail"
                  name="login"
                  placeholder="请填写您的邮箱，该邮箱与登录账号关联，将用于身份认证"
                ></el-input>
                <div
                  id="login_message"
                  class="msg"
                >请填写您的邮箱，该邮箱与登录账号关联，将用于身份认证
                </div>
              </td>
            </tr>
            <tr>
              <td>新的密码</td>
              <td>
                <el-input
                  v-model="sysUser.newPassword"
                  show-password
                  show-word-limit
                  maxlength="40"
                  placeholder="用户密码必须包括字母和数字"
                ></el-input>
                <div
                  id="newpassword1_message"
                  class="msg"
                >用户密码必须包括字母和数字
                </div>
              </td>
            </tr>
            <tr>
              <td>确认密码</td>
              <td>
                <el-input
                  v-model="sysUser.passwordConfirm"
                  show-password
                  show-word-limit
                  maxlength="40"
                  placeholder="请重复输入以确认您的密码"
                ></el-input>
                <div
                  class="msg"
                >请重复输入以确认您的密码
                </div>
              </td>
            </tr>
            </tbody>
          </table>
          <div align="center">
            <el-button
              type="primary"
              @click="updateSysUserOfPassword"
              v-realm="'system-configuration:sys-user:edit'"
            >更新</el-button>&nbsp;
            <el-button
              @click="_forward('system-config/admin_privilege_admin_list')"
            >返回</el-button>
          </div>
        </el-tab-pane>
      </el-tabs>
    </div>
  </div>
</div>
<div layout:fragment="js">
  <script src="/static/js/module/system-config/model/SysUser.js"></script>
  <script src="/static/js/module/system-config/api/sysRoleApi.js"></script>
  <script src="/static/js/module/system-config/api/sysUserApi.js"></script>
  <script src="/static/js/module/system-config/api/sysUserRoleApi.js"></script>
  <script src="/static/js/module/system-config/admin_privilege_admin_edit.js"></script>
</div>
</body>
</html>
